home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 June / Cd Pc Users 9.iso / prog / inst / gvocx / test.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1997-12-27  |  15.4 KB  |  518 lines

  1. VERSION 5.00
  2. Object = "{E7EDC303-766F-11CF-A64F-0020AF37425D}#1.0#0"; "GVBOX.OCX"
  3. Begin VB.Form Form1 
  4.    Appearance      =   0  'Flat
  5.    BackColor       =   &H80000005&
  6.    Caption         =   "Graphics Viewer - OCX"
  7.    ClientHeight    =   6510
  8.    ClientLeft      =   135
  9.    ClientTop       =   825
  10.    ClientWidth     =   9480
  11.    BeginProperty Font 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H00000000&
  21.    LinkTopic       =   "Form1"
  22.    PaletteMode     =   1  'UseZOrder
  23.    ScaleHeight     =   434
  24.    ScaleMode       =   3  'Pixel
  25.    ScaleWidth      =   632
  26.    Begin VB.PictureBox Pic_GrayBox 
  27.       Appearance      =   0  'Flat
  28.       BackColor       =   &H00C0C0C0&
  29.       ForeColor       =   &H80000008&
  30.       Height          =   255
  31.       Left            =   9240
  32.       ScaleHeight     =   225
  33.       ScaleWidth      =   225
  34.       TabIndex        =   0
  35.       Top             =   6240
  36.       Visible         =   0   'False
  37.       Width           =   255
  38.    End
  39.    Begin VB.HScrollBar HScroll1 
  40.       Height          =   255
  41.       LargeChange     =   100
  42.       Left            =   0
  43.       SmallChange     =   20
  44.       TabIndex        =   1
  45.       Top             =   6240
  46.       Visible         =   0   'False
  47.       Width           =   9255
  48.    End
  49.    Begin VB.VScrollBar VScroll1 
  50.       Height          =   6255
  51.       LargeChange     =   100
  52.       Left            =   9240
  53.       SmallChange     =   20
  54.       TabIndex        =   2
  55.       Top             =   0
  56.       Visible         =   0   'False
  57.       Width           =   255
  58.    End
  59.    Begin GvboxLib.Gvbox Gvbox1 
  60.       Height          =   1500
  61.       Left            =   0
  62.       TabIndex        =   3
  63.       Top             =   0
  64.       Visible         =   0   'False
  65.       Width           =   1500
  66.       _Version        =   65536
  67.       _ExtentX        =   2646
  68.       _ExtentY        =   2646
  69.       _StockProps     =   105
  70.       BackColor       =   16777215
  71.       BorderStyle     =   1
  72.       AutoSize        =   1
  73.       DCTMethod       =   1
  74.       Dither          =   0
  75.       FancyUpsampling =   0   'False
  76.       FileName        =   ""
  77.       JPEGDither      =   1
  78.       PrintX          =   0
  79.       PrintY          =   0
  80.       Thumbnail       =   0
  81.       Zoom            =   1
  82.       PrintZoom       =   1
  83.       TwoPassQuantize =   0   'False
  84.    End
  85.    Begin VB.Menu Mnu_File 
  86.       Caption         =   "&File"
  87.       Begin VB.Menu Mnu_Print 
  88.          Caption         =   "&Print"
  89.          HelpContextID   =   2014
  90.       End
  91.       Begin VB.Menu Mnu_Exit 
  92.          Caption         =   "E&xit"
  93.       End
  94.    End
  95.    Begin VB.Menu Mnu_Picture 
  96.       Caption         =   "&Picture"
  97.       HelpContextID   =   2010
  98.       Begin VB.Menu Mnu_Open 
  99.          Caption         =   "&Open"
  100.          HelpContextID   =   2010
  101.       End
  102.       Begin VB.Menu Mnu_Close 
  103.          Caption         =   "&Close"
  104.          HelpContextID   =   2010
  105.       End
  106.    End
  107.    Begin VB.Menu Mnu_Options 
  108.       Caption         =   "&Options"
  109.       Begin VB.Menu Mnu_Auto 
  110.          Caption         =   "&Autosize"
  111.          HelpContextID   =   2005
  112.          Begin VB.Menu Mnu_AutoSize 
  113.             Caption         =   "&Off"
  114.             HelpContextID   =   2005
  115.             Index           =   0
  116.          End
  117.          Begin VB.Menu Mnu_AutoSize 
  118.             Caption         =   "Fit to &Bitmap"
  119.             Checked         =   -1  'True
  120.             HelpContextID   =   2005
  121.             Index           =   1
  122.          End
  123.          Begin VB.Menu Mnu_AutoSize 
  124.             Caption         =   "Fit &Horizontally"
  125.             HelpContextID   =   2005
  126.             Index           =   2
  127.          End
  128.          Begin VB.Menu Mnu_AutoSize 
  129.             Caption         =   "Fit &Vertically"
  130.             HelpContextID   =   2005
  131.             Index           =   3
  132.          End
  133.       End
  134.       Begin VB.Menu Mnu_Dither 
  135.          Caption         =   "&Dithering..."
  136.          HelpContextID   =   2007
  137.          Begin VB.Menu Mnu_Dith 
  138.             Caption         =   "&No Dithering"
  139.             HelpContextID   =   2007
  140.             Index           =   0
  141.          End
  142.          Begin VB.Menu Mnu_Dith 
  143.             Caption         =   "&Dither Always"
  144.             HelpContextID   =   2007
  145.             Index           =   1
  146.          End
  147.          Begin VB.Menu Mnu_Dith 
  148.             Caption         =   "Dither Extra &Colors"
  149.             Checked         =   -1  'True
  150.             HelpContextID   =   2007
  151.             Index           =   2
  152.          End
  153.       End
  154.       Begin VB.Menu Mnu_Thumbnail 
  155.          Caption         =   "&Thumbnail"
  156.          HelpContextID   =   2018
  157.       End
  158.    End
  159.    Begin VB.Menu Mnu_JPEG 
  160.       Caption         =   "&JPEG Options"
  161.       HelpContextID   =   2025
  162.       Begin VB.Menu Mnu_DCTM 
  163.          Caption         =   "&DCT Method..."
  164.          HelpContextID   =   2006
  165.          Begin VB.Menu Mnu_DCT 
  166.             Caption         =   "&Slow Integer"
  167.             HelpContextID   =   2006
  168.             Index           =   0
  169.          End
  170.          Begin VB.Menu Mnu_DCT 
  171.             Caption         =   "&Fast Integer"
  172.             Checked         =   -1  'True
  173.             HelpContextID   =   2006
  174.             Index           =   1
  175.          End
  176.          Begin VB.Menu Mnu_DCT 
  177.             Caption         =   "Floating &Point"
  178.             HelpContextID   =   2006
  179.             Index           =   2
  180.          End
  181.       End
  182.       Begin VB.Menu Mnu_JPGDithM 
  183.          Caption         =   "Dithering &Method..."
  184.          HelpContextID   =   2007
  185.          Begin VB.Menu Mnu_JPGDith 
  186.             Caption         =   "&None"
  187.             HelpContextID   =   2007
  188.             Index           =   0
  189.          End
  190.          Begin VB.Menu Mnu_JPGDith 
  191.             Caption         =   "&Ordered"
  192.             Checked         =   -1  'True
  193.             HelpContextID   =   2007
  194.             Index           =   1
  195.          End
  196.          Begin VB.Menu Mnu_JPGDith 
  197.             Caption         =   "&Floyd-Steinberg"
  198.             HelpContextID   =   2007
  199.             Index           =   2
  200.          End
  201.       End
  202.       Begin VB.Menu Mnu_Fancy 
  203.          Caption         =   "&Fancy Upsampline"
  204.          HelpContextID   =   2008
  205.       End
  206.       Begin VB.Menu Mnu_TwoPass 
  207.          Caption         =   "&Two Pass Quantize"
  208.          HelpContextID   =   2019
  209.       End
  210.    End
  211.    Begin VB.Menu Mnu_Zoom 
  212.       Caption         =   "&Zoom"
  213.       HelpContextID   =   2020
  214.       Begin VB.Menu Mnu_Pict 
  215.          Caption         =   "&Picture..."
  216.          HelpContextID   =   2020
  217.          Begin VB.Menu Mnu_PZoom 
  218.             Caption         =   "&50%"
  219.             Index           =   0
  220.          End
  221.          Begin VB.Menu Mnu_PZoom 
  222.             Caption         =   "&100%"
  223.             Checked         =   -1  'True
  224.             HelpContextID   =   2020
  225.             Index           =   1
  226.          End
  227.          Begin VB.Menu Mnu_PZoom 
  228.             Caption         =   "&200%"
  229.             HelpContextID   =   2020
  230.             Index           =   2
  231.          End
  232.          Begin VB.Menu Mnu_PZoom 
  233.             Caption         =   "&300%"
  234.             HelpContextID   =   2020
  235.             Index           =   3
  236.          End
  237.          Begin VB.Menu Mnu_PZoom 
  238.             Caption         =   "&400%"
  239.             HelpContextID   =   2020
  240.             Index           =   4
  241.          End
  242.       End
  243.       Begin VB.Menu Mnu_Prnt 
  244.          Caption         =   "P&rint..."
  245.          HelpContextID   =   2017
  246.          Begin VB.Menu Mnu_PrZoom 
  247.             Caption         =   "&100%"
  248.             HelpContextID   =   2017
  249.             Index           =   0
  250.          End
  251.          Begin VB.Menu Mnu_PrZoom 
  252.             Caption         =   "&200%"
  253.             Checked         =   -1  'True
  254.             HelpContextID   =   2017
  255.             Index           =   1
  256.          End
  257.          Begin VB.Menu Mnu_PrZoom 
  258.             Caption         =   "&300%"
  259.             HelpContextID   =   2017
  260.             Index           =   2
  261.          End
  262.          Begin VB.Menu Mnu_PrZoom 
  263.             Caption         =   "&400%"
  264.             HelpContextID   =   2017
  265.             Index           =   3
  266.          End
  267.          Begin VB.Menu Mnu_PrZoom 
  268.             Caption         =   "&500%"
  269.             HelpContextID   =   2017
  270.             Index           =   4
  271.          End
  272.       End
  273.    End
  274.    Begin VB.Menu Mnu_HelpM 
  275.       Caption         =   "&Help"
  276.       HelpContextID   =   2000
  277.       Begin VB.Menu Mnu_Help 
  278.          Caption         =   "&Contents"
  279.          HelpContextID   =   2000
  280.          Index           =   0
  281.       End
  282.       Begin VB.Menu Mnu_Help 
  283.          Caption         =   "&Events"
  284.          HelpContextID   =   2022
  285.          Index           =   1
  286.       End
  287.       Begin VB.Menu Mnu_Help 
  288.          Caption         =   "&Properties"
  289.          HelpContextID   =   2002
  290.          Index           =   2
  291.       End
  292.       Begin VB.Menu Mnu_Help 
  293.          Caption         =   "&Search"
  294.          Index           =   3
  295.       End
  296.       Begin VB.Menu Mnu_Help 
  297.          Caption         =   "&Using Help"
  298.          Index           =   4
  299.       End
  300.       Begin VB.Menu Mnu_Help 
  301.          Caption         =   "-"
  302.          Index           =   5
  303.       End
  304.       Begin VB.Menu Mnu_Help 
  305.          Caption         =   "&About"
  306.          HelpContextID   =   2004
  307.          Index           =   6
  308.       End
  309.    End
  310. Attribute VB_Name = "Form1"
  311. Attribute VB_GlobalNameSpace = False
  312. Attribute VB_Creatable = False
  313. Attribute VB_PredeclaredId = True
  314. Attribute VB_Exposed = False
  315. Option Explicit
  316. DefInt A-Z
  317. Dim I%, PX!, PY!
  318. Const CONTENTS& = 2000
  319. Const EVENTS& = 2022
  320. Const MODAL = 1
  321. Const HELP_CONTEXT = &H1
  322. Const HELP_HELPONHELP = &H4
  323. Const PROPERTIES& = 2002
  324. Const SEARCH& = 1
  325. Private Sub Form_Load()
  326.     ChDir App.Path
  327.     Move 0, 0
  328.     Width = Screen.Width
  329.     Height = Screen.Height
  330. End Sub
  331. Private Sub Form_Resize()
  332.     If Gvbox1.Height > Form1.ScaleHeight Then
  333.         VScroll1.Visible = True
  334.     Else
  335.         VScroll1.Visible = False
  336.     End If
  337.     If Gvbox1.Width > Form1.ScaleWidth Then
  338.         HScroll1.Visible = True
  339.     Else
  340.         HScroll1.Visible = False
  341.     End If
  342.     VScroll1.Max = Gvbox1.Height - Form1.ScaleHeight + HScroll1.Height
  343.     HScroll1.Max = Gvbox1.Width - Form1.ScaleWidth + VScroll1.Width
  344.     If VScroll1.Visible Or HScroll1.Visible Then
  345.         Pic_GrayBox.Visible = True
  346.     Else
  347.         Pic_GrayBox.Visible = False
  348.     End If
  349.     HScroll1.Width = Form1.ScaleWidth - VScroll1.Width
  350.     VScroll1.Height = Form1.ScaleHeight - HScroll1.Height
  351.     HScroll1.Move 0, Form1.ScaleHeight - HScroll1.Height
  352.     VScroll1.Move Form1.ScaleWidth - VScroll1.Width, 0
  353.     Pic_GrayBox.Move Form1.ScaleWidth - VScroll1.Width, Form1.ScaleHeight - HScroll1.Height
  354.     VScroll1.Max = Gvbox1.Height - Form1.ScaleHeight + HScroll1.Height
  355.     HScroll1.Max = Gvbox1.Width - Form1.ScaleWidth + VScroll1.Width
  356.     HScroll1.ZOrder
  357.     VScroll1.ZOrder
  358.     Pic_GrayBox.ZOrder
  359. End Sub
  360. Private Sub HScroll1_Change()
  361.     PX = -HScroll1.Value
  362.     Gvbox1.Move PX, PY
  363. End Sub
  364. Private Sub Mnu_AutoSize_Click(Index As Integer)
  365.     For I = 0 To 3
  366.     Mnu_AutoSize(I).Checked = False
  367.     Next I
  368.     Gvbox1.AutoSize = Index
  369.     Mnu_AutoSize(Index).Checked = True
  370. End Sub
  371. Private Sub Mnu_Close_Click()
  372.     Gvbox1.filename = ""
  373.     Gvbox1.Visible = False
  374.     HScroll1.Visible = False
  375.     VScroll1.Visible = False
  376.     Pic_GrayBox.Visible = False
  377. End Sub
  378. Private Sub Mnu_DCT_Click(Index As Integer)
  379.     For I = 0 To 2
  380.     Mnu_DCT(I).Checked = False
  381.     Next I
  382.     Gvbox1.DCTMethod = Index
  383.     Mnu_DCT(Index).Checked = True
  384. End Sub
  385. Private Sub Mnu_Dith_Click(Index As Integer)
  386.     For I = 0 To 2
  387.     Mnu_Dith(I).Checked = False
  388.     Next I
  389.     Gvbox1.Dither = Index
  390.     Mnu_Dith(Index).Checked = True
  391. End Sub
  392. Private Sub Mnu_Exit_Click()
  393.     End
  394. End Sub
  395. Private Sub Mnu_Fancy_Click()
  396.     If Mnu_Fancy.Checked Then
  397.         Mnu_Fancy.Checked = False
  398.     Else
  399.         Mnu_Fancy.Checked = True
  400.     End If
  401.     Gvbox1.FancyUpsampling = Mnu_Fancy.Checked
  402. End Sub
  403. Private Sub Mnu_Help_Click(Index As Integer)
  404.     Dim Ret%
  405.     Select Case Index
  406.     Case 0
  407.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, CONTENTS)
  408.     Case 1
  409.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, EVENTS)
  410.     Case 2
  411.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, PROPERTIES)
  412.     Case 3
  413.         Ret = WinHelp(Form1.hwnd, App.HelpFile, HELP_CONTEXT, SEARCH)
  414.     Case 4
  415.         Ret = WinHelp(Form1.hwnd, "", HELP_HELPONHELP, 0)
  416.     Case 6
  417.         About_Frm.Show MODAL
  418.     End Select
  419. End Sub
  420. Private Sub Mnu_JPGDith_Click(Index As Integer)
  421.     For I = 0 To 2
  422.     Mnu_JPGDith(I).Checked = False
  423.     Next I
  424.     Gvbox1.JPEGDither = Index
  425.     Mnu_JPGDith(Index).Checked = True
  426. End Sub
  427. Private Sub Mnu_Open_Click()
  428.     On Error GoTo Er_Hndl
  429.     Gvbox1.Visible = False
  430.     Gvbox1.filename = ""
  431.     Gvbox1.GVOpenPicture = True
  432.     If Gvbox1.filename <> "" Then
  433.         Gvbox1.Visible = True
  434.         VScroll1.Value = 0
  435.         HScroll1.Value = 0
  436.         Gvbox1.Left = 0
  437.         Gvbox1.Top = 0
  438.         VScroll1.Visible = False
  439.         HScroll1.Visible = False
  440.         Pic_GrayBox.Visible = False
  441.         Form_Resize
  442.     End If
  443.     Exit Sub
  444. Er_Hndl:
  445.     Beep
  446.     MsgBox Error$, 48, "Graphics Viewer"
  447.     Exit Sub
  448. End Sub
  449. Private Sub Mnu_Print_Click()
  450.     Screen.MousePointer = 11
  451.     Printer.Print " "
  452.     Printer.ScaleMode = 3
  453.     Gvbox1.PrintX = (Printer.ScaleWidth - (Gvbox1.bmpw * Gvbox1.PrintZoom)) / 2
  454.     Gvbox1.PrintY = (Printer.ScaleHeight - (Gvbox1.bmph * Gvbox1.PrintZoom)) / 2
  455.     Gvbox1.PrintHDC = Printer.hDC
  456.     Printer.EndDoc
  457.     Screen.MousePointer = 0
  458. End Sub
  459. Private Sub Mnu_PrZoom_Click(Index As Integer)
  460.     For I = 0 To 4
  461.     Mnu_PrZoom(I).Checked = False
  462.     Next I
  463.     Gvbox1.PrintZoom = Index + 1
  464.     Mnu_PrZoom(Index).Checked = True
  465. End Sub
  466. Private Sub Mnu_PZoom_Click(Index As Integer)
  467.     For I = 0 To 3
  468.     Mnu_PZoom(I).Checked = False
  469.     Next I
  470.     If Index = 0 Then
  471.         Gvbox1.Zoom = 0.5
  472.     Else
  473.         Gvbox1.Zoom = Index
  474.     End If
  475.     Mnu_PZoom(Index).Checked = True
  476.     If Gvbox1.Visible Then Form_Resize
  477. End Sub
  478. Private Sub Mnu_Thumbnail_Click()
  479.     If Mnu_Thumbnail.Checked Then
  480.         Mnu_Thumbnail.Checked = False
  481.         Gvbox1.Thumbnail = 0
  482.     Else
  483.         Mnu_Thumbnail.Checked = True
  484.         Gvbox1.Thumbnail = 100
  485.     End If
  486.     If Gvbox1.Thumbnail Then
  487.         VScroll1.Value = 0
  488.         HScroll1.Value = 0
  489.         Gvbox1.Left = 0
  490.         Gvbox1.Top = 0
  491.         VScroll1.Visible = False
  492.         HScroll1.Visible = False
  493.         Pic_GrayBox.Visible = False
  494.     Else
  495.         If Gvbox1.Visible Then Form_Resize
  496.     End If
  497. End Sub
  498. Private Sub Mnu_TwoPass_Click()
  499.     If Mnu_TwoPass.Checked Then
  500.         Mnu_TwoPass.Checked = False
  501.     Else
  502.         Mnu_TwoPass.Checked = True
  503.     End If
  504.     Gvbox1.TwoPassQuantize = Mnu_TwoPass.Checked
  505. End Sub
  506. Private Sub Pic_GrayBox_Click()
  507.     HScroll1.Value = HScroll1.Max
  508.     VScroll1.Value = VScroll1.Max
  509. End Sub
  510. Private Sub Pic_GrayBox_DblClick()
  511.     HScroll1.Value = 0
  512.     VScroll1.Value = 0
  513. End Sub
  514. Private Sub VScroll1_Change()
  515.     PY = -VScroll1.Value
  516.     Gvbox1.Move PX, PY
  517. End Sub
  518.